package BookAndAuthorWithArrayList;

import java.util.ArrayList;

public class Book {
	private String name;
	private double price;
	private ArrayList<Book_Author> author = new ArrayList<Book_Author>();

	private int qty = 0;

	public Book(String name, ArrayList<Book_Author> auth, double price) {
		this.name = name;
		author = auth;
		this.price = price;
	}

	public Book(String name, ArrayList<Book_Author> auth, double price, int qty) {
		this.name = name;
		author = auth;
		this.price = price;
		this.qty = qty;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public int getQty() {
		return qty;
	}

	public void setQty(int qty) {
		this.qty = qty;
	}

	public String getName() {
		return name;
	}

	public void addAuthor(Book_Author author) {
		this.author.add(author);
	}

	public String toString() {
		String s;
		String auth = author.toString();
		s = "Book[name=" + this.getName() + ",{";
		s += auth.substring(1, auth.length() - 1);
		s += "}price=" + this.getPrice() + ",qty=" + this.getQty() + "]";
		return s;
	}

}
